package com.whl215.kit.grape.wrapper

import com.whl215.kit.adapter.GrapeViewHolder
import com.whl215.kit.grape.R
import com.whl215.kit.adapter.wrap.GrapeNodeWrapper
import com.whl215.kit.grape.model.GoodsBean

/**
 * author： happiness
 * date： 2021/5/6
 * description：商品 一行两个
 */
data class GoodsOfTwoInRowNodeWrapper(private val item:GoodsBean) :ShopCartNodeWrapper() {
    override fun getPrice(): Int {
        return item.price
    }

    override fun getItemId(): String {
        return item.id
    }

    override fun onBindViewHolder(holder: GrapeViewHolder, position: Int) {
        holder.setChecked(R.id.item_cb_goods_selected,isSelected)
            .setText(R.id.item_tv_goods_name,item.name)
            .setOnClickListener(R.id.item_cb_goods_selected)
            .setOnClickListener(R.id.item_tv_delete)
    }

    override fun getViewType(): Int {
        return R.layout.item_wrapper_node_goods_of_two_in_row
    }

    override fun getItem(): Any {
        return item
    }

    override fun getSpanSize(): Int {
        return 1
    }
}